package sms_kuailian

type Config struct {
	AppKey    string `json:"app_key"`
	AppSecret string `json:"app_secret"`
	AppCode   string `json:"app_code"`
	GateHost  string `json:"gate_host"` // 默认 http://59.110.149.244:9090
}

var defaultCfg *Config

func LoadFrom(path string) (*Config, error) {
	cfg := new(Config)

	cfg.AppKey = "PBcfcq"
	cfg.AppSecret = "AgSaAE"
	cfg.AppCode = "1000"
	cfg.GateHost = "http://39.97.4.102:9090"

	defaultCfg = cfg
	return cfg, nil
}

func C() *Config {
	if defaultCfg == nil {
		panic("config not loaded")
	}
	return defaultCfg
}
